
 
 D C . t o g g l e C l a s s ( s t r i n g C l a s s N a m e ,   b o o l F o r c e S t a t e ,   f u n c t i o n C a l l b a c k ( c u r r e n t S t a t e ) ) 
 
 
 
 D e s c r i p t i o n :   T o g g l e s   a   c l a s s   n a m e   o n   D C . w r a p p e r . 
 
 
 
 R e t u r n s :   D C   O b j e c t . 
 
 
 
 N o t e :   W h e n   t h e   b o o l F o r c e S t a t e   p a r a m e t e r   i s   o m i t t e d ,   D C . t o g g l e C l a s s   w i l l   a u t o m a t i c a l l y   t o g g l e   i t s e l f   u s i n g   t h e   c u r r e n t   s t a t e .   O t h e r w i s e ,   t h e   b o o l F o r c e S t a t e   p a r a m e t e r   w i l l   f o r c e   a   t r u e   o r   f a l s e   s t a t e   t o   b e   s e t .   T h e   c a l l b a c k   f u n c t i o n   m a y   b e   u s e d   t o   p e r f o r m   a d d i t i o n a l   a c t i o n s   r e l a t i n g   t o   t h e   t o g g l e   s t a t e .   W h e n   t h e   c a l l b a c k   f u n c t i o n   i s   p a s s e d   a s   t h e   s e c o n d   p a r a m e t e r ,   t h e n   b o o l F o r c e S t a t e   i s   u n d e f i n e d . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   A u t o m a t i c a l l y   t o g g l e   b e t w e e n   t r u e   o r   f a l s e   b a s e d   o n   t h e   c u r r e n t   s t a t e   o f   t h e   c l a s s   n a m e   o n   D C . w r a p p e r . 
 
 D C . t o g g l e C l a s s ( " s e l e c t e d " ) ; 
 
 
 
 / /   A u t o m a t i c a l l y   t o g g l e   t h e   s t a t e   t o   t r u e   a n d   s e t   c l a s s   n a m e   o n   D C . w r a p p e r . 
 
 D C . t o g g l e C l a s s ( " s e l e c t e d " ,   t r u e ) ; 
 
 
 
 / /   A u t o m a t i c a l l y   t o g g l e   b e t w e e n   t r u e   o r   f a l s e   b a s e d   o n   t h e   c u r r e n t   s t a t e   o f   t h e   c l a s s   n a m e   o n   D C . w r a p p e r ,   a n d   r u n   a   c a l l b a c k   t o   p e r f o r m   a d d i t i o n a l   a c t i o n s . 
 
 D C . t o g g l e C l a s s ( " s e l e c t e d " ,   f u n c t i o n ( a c t i v e S t a t e )   { 
 
     / /   D o   s o m e t h i n g   w h e n   a c t i v e S t a t e   i s   t r u e   o r   f a l s e . 
 
     / /   ' t h i s '   =   D C . w r a p p e r . 
 
 } ) ; 
 
 
 
 / /   A u t o m a t i c a l l y   t o g g l e   t h e   s t a t e   t o   f a l s e   a n d   r e m o v e   c l a s s   n a m e   o n   D C . w r a p p e r ,   a n d   r u n   a   c a l l b a c k   t o   p e r f o r m   a d d i t i o n a l   a c t i o n s . 
 
 D C . t o g g l e C l a s s ( " s e l e c t e d " ,   f a l s e ,   f u n c t i o n ( a c t i v e S t a t e )   { 
 
     / /   D o   s o m e t h i n g   w h e n   a c t i v e S t a t e   i s   t r u e   o r   f a l s e . 
 
     / /   ' t h i s '   =   D C . w r a p p e r . 
 
 } ) ; 
 
 